<template>
    <div class="index-container">
        <v-breadcrumb :breadcrumbData="[{name: '基础数据'}, {name: '公司的基础数据'}]"></v-breadcrumb>

        <div class="g-box">
            <div class="table">
                <table class="width100 vd-table">
                    <tbody>
                    <tr>
                        <td style="width:130px">预售的首付比例</td>
                        <td>
                            <el-input placeholder="请填写预售的首付比例" v-model="addobj.pre_sale_percentage"
                                      class="width-400"/>
                            <span class="ml-5">%</span>
                        </td>
                    </tr>
                    <tr>
                        <td>合伙人是否购买</td>
                        <td>
                            <el-select v-model="addobj.partner_must_buy" class="width-400" placeholder="请选择">
                                <el-option label="合伙人购买首单后，促销活动才能正式上线" :value="1"></el-option>
                                <el-option label="促销活动直接上线，合伙人不需要购买" :value="2"></el-option>
                            </el-select>
                        </td>
                    </tr>
                    <tr>
                        <td>商品类型</td>
                        <td>
                            <el-select v-model="addobj.goods_type" class="width-400" placeholder="请选择">
                                <el-option label="实物商品（需要收货地址等）" :value="1"></el-option>
                                <el-option label="非实物商品" :value="2"></el-option>
                            </el-select>
                        </td>
                    </tr>
                    <tr>
                        <td>商品购买限制</td>
                        <td>
                            <el-select v-model="addobj.goods_can_buy" class="width-400" placeholder="请选择">
                                <el-option label="不限制，所有人都可以购买" :value="1"></el-option>
                                <el-option label="只有企业认证的用户可以购买" :value="2"></el-option>
                                <el-option label="只有个人认证的用户可以购买" :value="3"></el-option>
                                <el-option label="企业和个人同时认证的用户才能购买" :value="4"></el-option>
                            </el-select>
                        </td>
                    </tr>
                    <tr>
                        <td></td>
                        <td>
                            <el-button v-preventDbClick @click="submit" type="primary" class="width-100">确定
                            </el-button>
                        </td>
                    </tr>

                    </tbody>
                </table>

            </div>
        </div>

    </div>
</template>

<script type="text/ecmascript-6">
import request from '../../common/js/request.js';
import {tool} from "../../common/js/tool.js";
import config from '../../common/js/config.js'

export default {
    data() {
        return {
            addobj: {
                pre_sale_percentage: '',
                partner_must_buy: 1,
                goods_type: 1,
                goods_can_buy: 1
            }
        };
    },

    computed: {},

    mounted() {
    },

    created() {
        this.getData();
    },

    methods: {
        getData() {
            request({
                url: '/manage/basicData/one',
            }).then((res) => {
                this.addobj.pre_sale_percentage = res.data.pre_sale_percentage;
                this.addobj.partner_must_buy = Number(res.data.partner_must_buy);
                this.addobj.goods_type = Number(res.data.goods_type);
                this.addobj.goods_can_buy = Number(res.data.goods_can_buy);
            })
        },
        submit() {
            request({
                url: '/manage/basicData/edit',
                data: this.addobj
            }).then((res) => {
                tool.message(res.msg, 'success', () => {
                    //this.gotoPage('/home')
                })
            })
        },
        uploadTitleImage(a) {
            this.addobj.logo = a;
        },
        uploadBgImage(a) {
            this.addobj.manage_login_bg = a;
        },
    },

};
</script>

<style lang="less" rel="stylesheet/less" scoped>
@import url("../../common/css/variable.less");
</style>
